<template>
    <div class="container">
        <div class="left">
            <div class="title" v-html="text"></div>
            <div class="desc">关于<span>ikun</span></div>
        </div>
        <div class="right">
            <div class="glass">IKUN 甄选</div>
            <!-- <video class="video-bg" autoplay muted loop preload="auto">
                <source src="https://t.mwm.moe/acg/acg" type="video/mp4" />
            </video> -->
        </div>
    </div>
</template>

<script setup lang="ts">
import { onMounted, ref } from "vue";

/**
 * 以颜色为背景，然后给它本身加上很强的模糊滤镜，再在这上面写文字。就能营造一种毛玻璃的颗粒感，好像在玻璃上写字。
 */

onMounted(() => {
    print("WELCOME TO\nJAVASCRIPT");
});

const text = ref<string>("");
// 打印机效果
const print = async (printInfo: string) => {
    const printText = printInfo;
    for (let i = 0; i < printText.length; i++) {
        const str = printText.slice(i, i + 1);
        if (str === "\n") {
            text.value = text.value + "<br>";
        } else {
            await new Promise(resolve => {
                setTimeout(() => {
                    text.value = text.value + str;
                    resolve(null);
                }, 80);
            });
        }
    }
};
</script>

<style scoped lang="scss">
@font-face {
    font-family: Regular;
    font-weight: 400;
    src:
        url("../../assets/iconfont/login_register.woff2") format("woff2"),
        url("../../assets/iconfont/login_register.woff") format("woff");
    font-display: swap;
}
.container {
    position: relative;
    top: 50%;
    left: 50%;
    display: flex;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    .left {
        position: relative;
        z-index: 0;
        box-sizing: border-box;
        display: flex;
        flex: 16;
        flex-direction: column;
        width: 100%;
        height: 100%;
        padding: 20% 0;
        &::before {
            position: absolute;
            top: 40%;
            left: 30%;
            z-index: -1;
            width: 280px;
            height: 100px;
            content: "";

            /* background: linear-gradient(to right, #4460f1, #c471ed, #f64f59); */
            background: linear-gradient(to right, blue, red);
            filter: blur(70px);
            transition: all 0.5s;
        }
        &:has(.desc:hover) {
            &::before {
                filter: blur(55px);
            }
        }
        .title {
            box-sizing: border-box;
            width: 100%;
            height: 120px;
            padding-left: 25%;
            font-family: Regular;
            font-size: 40px;
            font-weight: bold;
            line-height: 60px;
            color: #333333;
        }
        .desc {
            z-index: 2;
            padding-left: 45%;
            margin-top: 10px;
            font-size: 15px;
            font-weight: bold;
            color: #505050;
            cursor: pointer;
            span {
                color: #5140f0;
                text-decoration: underline;
            }
        }
    }
    .right {
        position: relative;
        display: flex;
        flex: 18;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 2rem;
        font-weight: bold;
        color: white;

        /* background-image: linear-gradient(to right, #4460f1, #c471ed, #f64f59); */

        background: url("https://t.mwm.moe/mp") no-repeat center center;
        background-size: cover;
        border-radius: 1rem;
        .video-bg {
            position: absolute;
            inset: 0;
            top: 50%;
            z-index: -1;
            display: block;
            width: 100%;
            overflow: hidden;
            transform: translate(0, -50%);
        }
        .glass {
            @include flex-center;

            width: 50%;
            height: 30%;
            overflow: hidden;
            background: transparent;
            backdrop-filter: blur(20px);
            border-radius: 1rem;
        }
    }
}
</style>
